package cn.arikeky.service.impl;

import cn.arikeky.domain.Movie;
import cn.arikeky.mapper.MovieMapper;
import cn.arikeky.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class MovieServiceImpl implements MovieService {

    @Autowired
    private MovieMapper movieMapper;

    @Override
    public List<Movie> findMAll() {
        return movieMapper.findMAll();
    }

    @Override
    @Transactional
    public void addM(Movie movie) {
        movieMapper.addM(movie);
    }

    @Override
    @Transactional
    public void updateM(Movie movie) {
        movieMapper.updateM(movie);
    }

    @Override
    @Transactional
    public void deleteM(Long id) {
        movieMapper.deleteM(id);
    }

    @Override
    public Movie findMById(Long id) {
        return movieMapper.findMById(id);
    }
}
